package com.liusand.mapper;

import com.liusand.dto.UpdateOrderDto;
import com.liusand.pojo.Order;
import com.liusand.pojo.OrderDetail;
import com.liusand.vo.ClientOrderVo;
import com.liusand.vo.OrderVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;

/**
 * @author :liusha
 * packageName :com.liusand.mapper
 * fileName :OrderServiceMapper
 * creationTime :2022/12/5 18:51
 */
@Mapper
public interface OrderMapper {
    int insertOrder(@Param("order") Order order);

    List<OrderVo> page(@Param("beginTime") LocalDateTime beginTime,
                       @Param("endTime") LocalDateTime endTime,
                       @Param("number") String number,
                       @Param("start") Integer start,
                       @Param("pageSize") Integer pageSize);

    Long countPage(@Param("beginTime") LocalDateTime beginTime,
                   @Param("endTime") LocalDateTime endTime,
                   @Param("number") String number);

    int updateOrderStatus(@Param("updateOrderDto") UpdateOrderDto updateOrderDto);

    int insertOrderDetails(@Param("orderDetailList") List<OrderDetail> orderDetailList);

    List<ClientOrderVo> userPage(@Param("userId") String userId,
                                 @Param("start") Integer start,
                                 @Param("pageSize") Integer pageSize);

    Long countUserPage(@Param("userId") String userId);

    List<OrderDetail> selectOrderDetailsByOrderIds(@Param("ids") Set<String> ids);
}
